package how2quit.apps.kleague;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.LinearLayout;

public class IntroActivity extends Activity {
	private static final String TAG = "IntroActivity";

	private LinearLayout innerLinearLayout;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.intro);
		
		
		
		validateSize();
		
		innerLinearLayout = (LinearLayout) findViewById(R.id.innerLinearLayout);
		ImageButton standingButton = (ImageButton) findViewById(R.id.standingButton);
		standingButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(IntroActivity.this, StandingActivity.class);
				startActivity(intent);
				
			}
		});
		
		ImageButton formationButton = (ImageButton) findViewById(R.id.formationButton);
		formationButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(IntroActivity.this, FormationActivity.class);
				startActivity(intent);
			}
		});
		
		ImageButton predictButton = (ImageButton) findViewById(R.id.predictButton);
		predictButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(IntroActivity.this, DropTestActivity.class);
				startActivity(intent);
			}
		});
		//inflateLayout();
		
	}
	private void inflateLayout(){
		LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View view = layoutInflater.inflate(R.layout.frame_image_view, null);
		//((ImageView)view).getDrawable().
		Log.w(TAG, "view size:" + view.getMeasuredWidth() + "x" + view.getMeasuredHeight());
		for(int i=0;i<8;i++)
		View.inflate(this, R.layout.frame_image_view, innerLinearLayout);
		Log.w(TAG, "inflated view's parent:" + view.getPaddingBottom());
		
	}
	private void validateSize(){
		DisplayMetrics metrics = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(metrics);
		
		Log.w(TAG, "window size:" + metrics.widthPixels + "x" + metrics.heightPixels);
	}

}
